package com.gdface.admin.gdface_attend;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;

/**
 * Created by admin on 2018/1/5.
 */

public class AdminActivity extends AppCompatActivity {

    private Button bt_Enroll, bt_User, bt_Log, bt_Setting;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_admin);

        init();
    }

    private void init() {
        bt_Enroll = (Button) findViewById(R.id.admin_bt_enroll);
        bt_Log = (Button) findViewById(R.id.admin_bt_log);
        bt_User = (Button) findViewById(R.id.admin_bt_user);
        bt_Setting = (Button) findViewById(R.id.admin_bt_setting);

        bt_Enroll.setOnClickListener(listener);
        bt_User.setOnClickListener(listener);
        bt_Log.setOnClickListener(listener);
        bt_Setting.setOnClickListener(listener);
    }

    View.OnClickListener listener = new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            switch (v.getId()) {
                case R.id.admin_bt_enroll:
                    startActivity(new Intent(AdminActivity.this, EnrollActivity.class));
                    break;
                case R.id.admin_bt_user:
                    startActivity(new Intent(AdminActivity.this, Show_User_Activity.class));
                    break;
                case R.id.admin_bt_log:
                    startActivity(new Intent(AdminActivity.this, Show_Log_Activity.class));
                    break;
                case R.id.admin_bt_setting:
                    break;
            }
        }
    };

    @Override
    public void onBackPressed() {
        super.onBackPressed();

        startActivity(new Intent(AdminActivity.this, IdentifyActivity.class));
        this.finish();
    }
}
